<script src="./ajax.js"></script>
<script>
// let json = null
// ajax('./a.json').then(r => json = r)
// console.log(json) // null
</script>
<script type="module">
let json = null
try{
  json = await ajax('./a1.json')
} catch(e) {
  console.log(e)
}
console.log(json) // 1
</script>